<template>
	<svg :style="iconStyle" aria-hidden="true">
		<use :xlink:href="symbolId" />
	</svg>
</template>

<script setup name="SvgIcon">
import { computed } from "vue";
// 接收父组件参数并设置默认值
const props = defineProps({
	name: String,
	iconStyle: {
		type: Object,
		default: { width: "18px", height: "18px" }
	}
})

const symbolId = computed(() => `#icon-${props.name}`);
</script>